package com.cqndt.disaster.device.controller;

import java.util.List;
import com.cqndt.disaster.device.domain.*;
import com.cqndt.disaster.device.util.Result;
import com.cqndt.disaster.device.service.TabAreaService;
import org.springframework.web.bind.annotation.PostMapping;
import com.cqndt.disaster.device.service.TabTwoRoundService;
import com.cqndt.disaster.device.service.TabStaticTypeService;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author lgb
 * @date 2020-8-31
 * @说明 获取基础数据
 **/
@RestController
@RequestMapping("/comm/")
public class CommController extends BaseController{
	
	@Autowired
    private TabAreaService tabAreaService;
    @Autowired
    private TabStaticTypeService tabStaticTypeService;
    @Autowired
    private TabTwoRoundService tabTwoRoundService;
    /**
     * @param staticNum
     * @return 静态值类型值
     **/
    @PostMapping(value="getTabStatic")
    public Result getTabDevice(String staticNum){
        Result result = new Result();
        List<TabStaticType> list = tabStaticTypeService.selectByStaticNum(staticNum);
        result.setData(list);
        return result;
    }
    /**
     * @param areaCode
     * @return 获取区域
     **/
    @PostMapping(value="getTabArea")
    public Result getTabArea(String areaCode){
        Result result = new Result();
        List<TabArea> list = tabAreaService.selectByAreaCode(areaCode);
        result.setData(list);
        return result;
    }
    /**
     * @param relationNo 项目编号
     * @param modelType 查询项目、灾害点或设备的全景图(1灾害点、 2项目、 3设备)
     * @return 根据编号(项目编号、灾害点编号、设备编号)查询全景图
     **/
    @PostMapping(value="getTabTwoRound")
    public Result getTabTwoRound(String relationNo,String modelType){
        Result result = new Result();
        List<TabTwoRound> list = tabTwoRoundService.selectByRelationNo(relationNo,modelType);
        result.setData(list);
        return result;
    }
}